home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / Exit.au3 < prev    next >
Text File  |  2007-09-08  |  503b  |  22 lines

  1. ;First Example
  2. Exit
  3.  
  4. ;Second Example
  5. ; Terminate script if no command-line arguments
  6. If $CmdLine[0] = 0 Then Exit(1)
  7.  
  8. ;Third Example
  9. ; Open file specified as first command-line argument
  10. $file = FileOpen($CmdLine[1], 0)
  11.  
  12. ; Check if file opened for reading OK
  13. If $file = -1 Then Exit(2)
  14.  
  15. ; If file is empty then exit (script is successful)
  16. $line = FileReadLine($file)
  17. If @error = -1 Then Exit
  18.  
  19. ;code to process file goes here
  20. FileClose($file)
  21. Exit ;is optional if last line of script
  22.